public class BrowserBannedListViewAdapter extends BaseAdapter {
Context mContext;
private static List<BrowserBannedSites> listUrlForAdapter;
AppSQLiteHelper db;
public BrowserBannedListViewAdapter(Context c, List<BrowserBannedSites> urls) {
mContext = c;
listUrlForAdapter = urls;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return listUrlForAdapter.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
static class ViewHolder {
TextView text;
ImageView icon;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
LayoutInflater li = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
convertView = li.inflate(R.layout.row_fragment_browser_url, null);
viewHolder = new ViewHolder();
viewHolder.text = (TextView) convertView
.findViewById(R.id.tv_fragment_browser_url_name);
viewHolder.icon = (ImageView) convertView
.findViewById(R.id.iv_fragment_browser_delete);
viewHolder.icon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
db=new AppSQLiteHelper(mContext);
int tempID =listUrlForAdapter.get(position).get_Id();
db.deleteBannedSites(tempID);
//******************** here is where i want to refresh my listview
}
});
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.text.setText(listUrlForAdapter.get(position).get_browserBannedSitesAddress());
return convertView;
}
}
How to calling a fragmnet inside its ListView Adapter?
2235
14-Oct-2014
I have a Fragment which has a ListView inside it , in each row of my ListView i have a delete Button which works perfectly, what i need is to refresh my ListView to show the updated data. my question is how can i refresh my ListView inside its Adapter. this is my Adapter:
Updated on 14-Oct-2014
Anonymous User
14-Oct-2014Anonymous User
14-Oct-2014